<?php
if(extension_loaded('zlib')){//检查服务器是否开启了zlib拓展
ob_start('x_wmzz_zlib_js_com');
}
header ("content-type:application/x-javascript; charset: UTF-8");//注意编码
header ("cache-control: must-revalidate");
$offset = 60 * 60 * 24;//css文件的距离现在的过期时间，这里设置为一天
$expire = "expires: " . gmdate ("D, d M Y H:i:s", time() + $offset) . " GMT";
header ($expire);
ob_start("compress");
function compress($buffer) {//去除文件中的注释和空行
$patterns = array('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '/\n[\s| ]*\r/',);  
$buffer = preg_replace($patterns, '', $buffer);
return $buffer;
}

compress(include('../script/wmzhizhe.js').include('../script/jquery.lavalamp-1.3.4.js').include('../script/theme_script.js').include('../../../plugins/syntaxHighlighter/brush/brush.js'));

if(extension_loaded('zlib')){
ob_end_flush();//输出buffer中的内容，即压缩后的js文件
}
?>